package com.bacel.nb.product.core.dao.impl;

import com.bacel.nb.product.core.dao.ISysmoduleDao;
import com.bacel.nb.product.core.domain.Sysmodule;
import com.bacel.nb.product.core.domain.Sysuser;
import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Bacel on 2017/4/4.
 */
@Repository
public final class SysmoduleDao extends BaseDaoImpl<Sysmodule> implements ISysmoduleDao {
    @Override
    public List<Sysmodule> getusermenudata(Sysuser user) {
        String hql="select sm from Sysmodule as sm, Sysroleright as srr " +
                "where srr.sysmoduleByModuleid  = sm.id and srr.sysroleByRoleid=:roleid ";
        Query query   =  getSession().createQuery(hql);
        query.setParameter("roleid",user.getSysroleByRoleid());
        return query.list();
    }
}
